package test_achieve.web.scenes;
import constant.Pm;
import cucumber.api.PendingException;
import cucumber.api.java.en.Given;
import test_achieve.web.Oneself;
import test_achieve.web.OrderMain;


/**
 * Created by chenkuo on 2017/10/23.
 */
public class OneToOne {

    /**一取一投及时单下单场景
     * 不包含：交通方式、代收货款*/


    /**前置：“在线下单”界面
     * 步骤：订单详细信息输入*/

    @Given("^w输入一取一投类型订单信息"+Pm.p9)
    public void w输入一取一投订单信息(String sendAdress,String sendName,String sendMobile,String receiveAddress,String receiveName,String receiveMobile,String weight,String goodsName,String remark) throws Throwable {
        Basic basic = new Basic();
        basic.w输入寄件人信息与收件人信息( sendAdress, sendName, sendMobile, receiveAddress, receiveName, receiveMobile);
        basic.w输入物品信息( weight, goodsName, remark);
    }

    @Given("^w输入一取一投订单信息"+Pm.p4)
    public void w输入一取一投订单信息(String sendAdress,String sendMobile,String receiveAddress,String weight) throws Throwable {
        w输入一取一投订单信息( sendAdress, null, sendMobile, receiveAddress, null, null, weight, null, null);
    }

    @Given("^w输入一取一投订单信息"+Pm.p3)
    public void w输入一取一投订单信息(String sendAdress,String receiveAddress,String weight) throws Throwable {
        w输入一取一投订单信息( sendAdress, null, null, receiveAddress, null, null, weight, null, null);
    }

    @Given("^w输入一取一投订单信息"+Pm.p2)
    public void w输入一取一投订单信息(String sendAdress,String receiveAddress) throws Throwable {
        w输入一取一投订单信息( sendAdress, null, null, receiveAddress, null, null, null, null, null);
    }



    /**前置：无
     * 步骤：登录账户，切换城市，订单详细信息输入*/

    @Given("^w登录并输入一取一投类型订单的详细信息"+Pm.p11)
    public void w登录并输入一取一投类型订单的详细信息(String username,String city,String sendAdress,String sendName,String sendMobile,String receiveAddress,String receiveName,String receiveMobile,String weight,String goodsName,String remark) throws Throwable {
        Basic basic = new Basic();
        basic.w登录并切换城市( username, city);
        w输入一取一投订单信息( sendAdress, sendName, sendMobile, receiveAddress, receiveName, receiveMobile, weight, goodsName, remark);
    }

    @Given("^w登录并输入一取一投类型订单的详细信息"+Pm.p7)
    public void w登录并输入一取一投类型订单的详细信息(String username,String city,String sendAdress,String sendMobile,String receiveAddress,String goodsName,String remark) throws Throwable {
        w登录并输入一取一投类型订单的详细信息( username, city, sendAdress, null, sendMobile, receiveAddress, null, null, null, goodsName, remark);
    }

    @Given("^w登录并输入一取一投类型订单的详细信息"+Pm.p6)
    public void w登录并输入一取一投类型订单的详细信息(String username,String city,String sendAdress,String receiveAddress,String weight,String goodsName) throws Throwable {
        w登录并输入一取一投类型订单的详细信息( username, city, sendAdress, null, null, receiveAddress, null, null, weight, goodsName, null);
    }

    @Given("^w登录并输入一取一投类型订单的详细信息"+Pm.p5)
    public void w登录并输入一取一投类型订单的详细信息(String username,String city,String sendAdress,String sendMobile,String receiveAddress) throws Throwable {
        w登录并输入一取一投类型订单的详细信息( username, city, sendAdress, null, sendMobile, receiveAddress, null, null, null, null, null);
    }



    /**前置：已登录
     * 步骤：切换城市，订单详细信息输入*/

    @Given("^w登录状态下一个一取一投及时单"+Pm.p10)
    public void w已登录并且下一个一取一投及时单(String city,String sendAdress,String sendName,String sendMobile,String receiveAddress,String receiveName,String receiveMobile,String weight,String goodsName,String remark) throws Throwable {
        Oneself me = new Oneself();
        OrderMain webmain = new OrderMain();
        me.w切换城市(city);
        me.w进入在线下单界面();
        w输入一取一投订单信息( sendAdress, sendName, sendMobile, receiveAddress, receiveName, receiveMobile, weight, goodsName, remark);
        webmain.wClickNext();
        webmain. wSubmitOrder();
        webmain.w确认订单提交成功();
    }

    @Given("^w登录状态下一个一取一投及时单"+Pm.p6)
    public void w已登录并且下一个一取一投及时单(String city,String sendAdress,String receiveAddress,String weight,String goodsName,String remark) throws Throwable {
        w已登录并且下一个一取一投及时单( city, sendAdress, null, null, receiveAddress, null, null, weight, goodsName, remark);
    }

    /**前置：无
     * 步骤：登录，切换城市，详细信息输入，下单*/

    @Given("^w用户下了一个一取一投及时单"+Pm.p11)
    public void w用户下了一个一取一投及时单(String username,String city,String sendAdress,String sendName,String sendMobile,String receiveAddress,String receiveName,String receiveMobile,String weight,String goodsName,String remark) throws Throwable {
        OrderMain webmain = new OrderMain();
        w登录并输入一取一投类型订单的详细信息( username, city, sendAdress, sendName, sendMobile, receiveAddress, receiveName, receiveMobile, weight, goodsName, remark);
        webmain.wClickNext();
        webmain. wSubmitOrder();
    }

    @Given("^w用户下了一个一取一投及时单"+Pm.p6)
    public void w用户下了一个一取一投及时单(String username,String sendAdress,String receiveAddress,String weight,String goodsName,String remark) throws Throwable {
        w用户下了一个一取一投及时单( username, null, sendAdress, null, null, receiveAddress, null, null, weight, goodsName, remark);
    }

    @Given("^w用户下了一个一取一投及时单"+Pm.p5)
    public void w用户下了一个一取一投及时单(String username,String sendAdress,String receiveAddress,String weight,String goodsName) throws Throwable {
        w用户下了一个一取一投及时单( username, null, sendAdress, null, null, receiveAddress, null, null, weight, goodsName, null);
    }

    @Given("^w用户下了一个一取一投及时单"+Pm.p4)
    public void w用户下了一个一取一投及时单(String username,String city,String sendAdress,String receiveAddress) throws Throwable {
        w用户下了一个一取一投及时单( username, city, sendAdress, null, null, receiveAddress, null, null, null, null, null);
    }

    @Given("^w用户下了一个一取一投及时单"+Pm.p3)
    public void w用户下了一个一取一投及时单(String username,String sendAdress,String receiveAddress) throws Throwable {
        w用户下了一个一取一投及时单( username, null, sendAdress, null, null, receiveAddress, null, null, null, null, null);
    }



}
